# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=scrcpy
pkgver=1.14
pkgrel=0
pkgdesc="Display and control your Android device"
url="https://github.com/Genymobile/scrcpy"
arch="all !s390x !ppc64le !mips !mips64" # limited by android-tools
license="Apache-2.0"
options="!check" # no test suite
depends="android-tools"
makedepends="ffmpeg-dev mesa-dev meson sdl2-dev"
subpackages="$pkgname-doc"
source="scrcpy-$pkgver.tar.gz::https://github.com/Genymobile/scrcpy/archive/v$pkgver.tar.gz
	https://github.com/Genymobile/scrcpy/releases/download/v$pkgver/scrcpy-server-v$pkgver"

build() {
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		-Dcompile_server=false \
		-Dprebuilt_server=/usr/share/scrcpy/scrcpy-server-v$pkgver \
		. output
	ninja -C output
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
	install -Dm644 "$srcdir"/scrcpy-server-v$pkgver \
		"$pkgdir"/usr/share/scrcpy/scrcpy-server
}

sha512sums="3c617130077f34e62696223a14ece01ecf496c7688a9fbe2ff546c1c2da5723652c38a2089130fee4158b19dca585fd2739c33ba1b653bf288d78d559cdb9760  scrcpy-1.14.tar.gz
791b2847882749994a6e013cc964aa2d6c23e6550b86352f81874e8d23c495740d15aa4872a59cb3529b8210f59a230014aa7c369150609ef7e907f6199f9d80  scrcpy-server-v1.14"
